//
// Created by 梅朝阳 on 2021/6/27.
//

#ifndef CUDA_PRACTICE_HANDEL_ERROR_H
#define CUDA_PRACTICE_HANDEL_ERROR_H

#include <cstdio>

#define HANDLE_ERROR(err) (HandleError(err, __FILE__, __LINE__))

static void HandleError(cudaError err, const char *file, int line){
    if(err != cudaSuccess){
        printf("%s in %s at line %d\n", cudaGetErrorString(err), file, line);
        exit(EXIT_FAILURE);
    }
}


#endif //CUDA_PRACTICE_HANDEL_ERROR_H
